const cluster = require('cluster')
const http = require('http')
if (cluster.isMaster) {
  cluster.setupMaster({
    exec:'./child.js'
  })
  cluster.fork()
  cluster.on('fork', (work) => {
    console.log('子进程 ' + work.id + "被开启");
  })
  cluster.on('online', () => {

  })
  cluster.on('listen', () => {

  })
  console.log('这段代码运行在主进程中');
  console.log('cluster.settings属性值：%j',cluster.settings);

} 